<template>
	<view class="content">
				<swiper-item class="swiper-item" style="height: 100%;width: 100%;">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
            <view>
                <uni-search-bar @confirm="search" :focus="true" v-model="searchValue" @blur="blur" @input="input" @cancel="cancel" @change="change" @clear="clear">
            </uni-search-bar>
            </view>
						<view v-for="(item,index) in TalentList" class="box1" @click="getTalent(item.talentSupplyId)">
							<u-row>
								<u-col span="4">
									<view class="iconbox1">
										<image :src="item.image">
									</view>
								</u-col>
								<u-col span="8">
									<view class="textbox">{{item.name}}</view>
									<view class="notebox u-line-1">学历：{{degreelist[item.degree]}}</view>
									<view class="notebox u-line-1">应聘职位：{{item.profession}}</view>
									<view class="notebox u-line-1">期望薪资：{{item.salaryMin}}k-{{item.salaryMax}}k</view>
									<view class="notebox u-line-1">发布时间：{{item.publishTime}}  </view>
								</u-col>
							</u-row>
						</view>
					</scroll-view>
				</swiper-item>
        <u-tabbar :list="tabbar" active-color="#1296db" height="110"></u-tabbar>
		</view>

	</view>
</template>

<script>
	import global from 'store/global.js'
	export default {
		data() {
			return {
				model:
					{
					  businessAddress: '',
					  businessId:'' ,
					  businessPosition:' ',
					  companyId:'',
					  contactAddress: '',
					  contactPosition:'',
					  degree: '',
					  demand: '',
					  education: '',
					  email:'',
					  image:'',
					  job: '',
					  location:'',
					  name: '',
					  netAddress: '',
					  phone: '',
					  title1: '',
					  title2: '',
					  title3:'',
					},
				list: [{
						name: '简历推荐'
					},
					{
						name: '职位发布'
					},
					{
						name: '简历管理'
					},
				],
				degreelist: ['专科', '本科', '硕士', '博士'],
				current: 0,
				swiperCurrent: 0,
				dx: 0,
				searchValue: '',
				degree: '',
				StateIndex: 0,
				index: 0,
				TalentList: '',
				degree: '',
				condition:'',
				degree2: '全部',
				publishTime2: '全部',
				optionsDegree: [{
						label: "全部",
						value: "全部",
					},
					{
						label: "本科",
						value: "1",
					},
					{
						label: "硕士",
						value: "2",
					},
					{
						label: "博士",
						value: "3",
					}
				],
				optionsPublishTime: [{
						label: "全部",
						value: "全部",
					},
					{
						label: "一个月内",
						value: "一个月内",
					},
					{
						label: "三个月内",
						value: "三个月内",
					},
					{
						label: "六个月内",
						value: "六个月内",
					},
					{
						label: "一年内",
						value: "一年内",
					},
				],
			}
		},
		onLoad() {
			this.tabbar = global.tabbar;
			this.GetTalentList()
		},

		methods: {
			change1(index) {
				if (index == '全部') {
					this.degree2 = '全部'
				} else {

					this.degree2 = index
				}
				this.GetTalentList()
			},
			change2(index) {
				if (index == '全部') {
					this.publishTime2 = '全部'
				} else {

					this.publishTime2 = index
				}
				this.GetTalentList()
			},

			//人才列表申请
			async GetTalentList() {
				const res = await this.$myRequest({
					url: '/talentsupply/listByDurationDegree',
					method: 'POST',
					header: {
						'content-type': 'application/json'
					},
					data: {
						"degree": this.degree2, //0，1,2,
						"duration": this.publishTime2 //
					}
				});
				this.TalentList = res.data.data

			},
			/* 点击进入人才详情页 */
			getTalent(talentSupplyId) {
				console.log(talentSupplyId)
				uni.navigateTo({
					url: "/pages/talent/interview_agree?talentSupplyId=" + talentSupplyId
				});
			},
			//头像选择
			chooseAvater() {
				this.chooseAvaters = true
			},
			editAvater(index) {
				if (index === 0) {
					this.chooseImage()
				} else {
					this.previewImage()
				}
			},

			chooseImage() {
				uni.chooseImage({
					count: 1, //限制图片上传数量，封顶9张
					success: (res) => { //拿到图片的返回数据
						this.imgArr = res.tempFilePaths
					}
				})
			},
			previewImage() {
				uni.previewImage({
					urls: [this.imgArr], //拿头像地址
				})
			},
			//搜索框
		async	search(fresh) {
				this.condition = fresh.value
				const res = await this.$myRequest({
					url: '/talentsupply/listByCondition',
					method: 'POST',
					header: {
						'content-type': 'application/json'
					},
					data: {
						"condition": this.condition,
					}
				});
				this.TalentList = res.data.data
			},


			tebchange(index) {
				this.swiperCurrent = index;

			},
			transition({
				detail: {
					dx
				}
			}) {
				this.$refs.tabs.setDx(dx);
			},
			animationfinish({
				detail: {
					current
				}
			}) {
				this.$refs.tabs.setFinishCurrent(current);
				this.swiperCurrent = current;
				this.current = current;
			},
		},
	}
</script>



<style lang="scss">
	.resumephoto {
		width: 100%;
		height: 15%;
		display: flex;
		justify-content: center;

		.photo image {
			width: 80px;
			height: 80px;
			border-radius: 100%;
			padding: 10px;
			align-items: center;
			background-color: #ffe9ea;
		}

	}

	.resumename {
		display: flex;
		justify-content: center;
		font-size: 40rpx;
		font-weight: 400rpx;
	}

	.self {
		display: flex;
		height: auto;
		width: auto;
		justify-content: center;

		.self_list {
			padding: 5rpx 10rpx;
			background-color: #e5e572;
			font-size: 30rpx;
			margin: 20rpx;
		}
	}

	.resumelist {
		font-size: 35rpx;
		font-weight: bold;
		padding: 9rpx 0rpx;

		.title {
			color: #007AFF;
			padding: 15rpx 10rpx;
			background-color: #ffffff;
			margin-top: 10rpx;
		}

		.titie_list {
			background-color: #ffffff;
			font-size: 30rpx;
			padding: 5rpx 30rpx;
			color: #000000;
			display: flex;
		}

		.InputMessage {
			width: 400rpx;
			padding-left: 50rpx;
		}

		.ChooseMessage {
			width: 100%;
			height: 50rpx;
			padding-bottom: 50rpx;
			padding-left: 10rpx;
		}
	}

	.box1 {
		border-bottom: 1px solid;
		border-color: #e6e6e6;
		height: 200rpx;
		background: #FFFFFF;

		.content {
			height: 100%;
		}

		.iconbox1 image {
			margin-left: 40rpx;
			margin-top: 28rpx;
			width: 80px;
			height: 80px;
		}

		.textbox {
			margin: 0 10rpx 5rpx 10rpx;
			padding: 10rpx 10rpx 5rpx 10rpx;
			font-weight: 750;
			color: #000000;
			line-height: 1.2;
			font-size: 28rpx;
		}

		.notebox {
			padding: 0 20rpx;
			font-size: 12px;
			color: #949494;
			line-height: 1.5;
		}

	}
</style>
